<?php

declare(strict_types=1);

namespace App\Bac\Request\RBAC;

use Hyperf\Validation\Request\FormRequest;

class PermissionRequest extends FormRequest
{
    protected array $scenes = [
        'add' => ['name', 'path_uri'],
        'edit' => ['id', 'name', 'path_uri'],
    ];

    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     */
    public function rules(): array
    {
        return [
            'id' => "required|integer",
            'name' => "required|string",
            'path_uri' => "required|string",
        ];
    }

    public function messages(): array
    {
        return [
            'id.required' => "id必传",
            'name.required' => "缺少唯一标识",
            'path_uri.required' => "路由为空",
        ];
    }
}
